using UnityEngine;

namespace Gj
{
    public class GroupHelper : NodeHelper
    {
        public CanvasGroup group;
        public Color disableColor = new(255, 255, 255, 0.4f);
        public Color originColor = new(255, 255, 255);

        protected bool disabled;

        protected override BindDataType bindDataType => BindDataType.Bool;

        protected override void BindData(bool b)
        {
            if (b)
                Enabled();
            else
                Disabled();
        }

        private void Disabled()
        {
            disabled = true;
            group.alpha = disableColor.a;
        }

        private void Enabled()
        {
            disabled = false;
            group.alpha = originColor.a;
        }
    }
}